home *** CD-ROM | disk | FTP | other *** search
/ CICA 1995 August / CICA - The Ultimate Collection of Shareware for Windows (Disc 2) (August 1995).iso / disc2 / patches / symantec / rtlinc.exe / STDLIB.H < prev    next >
C/C++ Source or Header  |  1993-09-28  |  7KB  |  249 lines

  1. /*_ stdlib.h   Thu May 24 1990   Modified by: Walter Bright */
  2. /* Copyright (C) 1986-1993 by Symantec        */
  3. /* All Rights Reserved                */
  4. /* $Revision:   1.10  $ */
  5.  
  6. #ifndef __STDLIB_H
  7. #define __STDLIB_H    1
  8.  
  9. #if __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. /* status for exit() or _exit()        */
  14. #define EXIT_SUCCESS    0
  15. #define EXIT_FAILURE    1
  16.  
  17. #ifndef NULL
  18. #if __COMPACT__ || __LARGE__ || __VCM__
  19. #define NULL    0L
  20. #else
  21. #define NULL    0
  22. #endif
  23. #endif
  24.  
  25. typedef unsigned size_t;
  26. typedef unsigned short wchar_t;
  27. #ifndef ERANGE
  28. #if M_UNIX || M_XENIX
  29. #define ERANGE    34
  30. #else
  31. #define ERANGE    1003
  32. #endif
  33. #endif
  34.  
  35. #if __ZTC__ < 0x220
  36. #define HUGE_VAL    1.797693134862315e+308
  37. #else
  38. #define HUGE_VAL    __inf
  39. #endif
  40.  
  41. #define RAND_MAX    32767
  42. #define MB_CUR_MAX    1
  43.  
  44. #pragma pack(__DEFALIGN)
  45. typedef struct _DIV { int  quot,rem; } div_t;
  46. typedef struct _LDIV { long quot,rem; } ldiv_t;
  47. #pragma pack()
  48.  
  49. #ifdef __STDC__
  50. #define __CDECL
  51. #define __STDCALL
  52. #else
  53. #define __CDECL __cdecl
  54. #define __STDCALL __stdcall
  55. #endif
  56.  
  57. #if __OS2__ && __INTSIZE == 4
  58. #define __CLIB    __STDCALL
  59. #else
  60. #define __CLIB    __CDECL
  61. #endif
  62.  
  63. #define _MAX_PATH   260 
  64. #define _MAX_DRIVE  3   
  65. #define _MAX_DIR    256 
  66. #define _MAX_FNAME  256 
  67. #define _MAX_EXT    256 
  68.  
  69. #if _MT
  70. extern int * __CLIB _errno(void);
  71. #define errno (*_errno())
  72. #else
  73. extern int __CLIB errno;
  74. #endif
  75.  
  76. double    __CLIB atof(const char *);
  77. int    __CLIB atoi(const char *);
  78. long    __CLIB atol(const char *);
  79. double    __CLIB strtod(const char *,char **);
  80. long    __CLIB strtol(const char *,char **,int);
  81. unsigned long    __CLIB strtoul(const char *,char **,int);
  82. int    __CLIB rand(void);
  83. void    __CLIB srand(unsigned);
  84. int    __CLIB random(int num);
  85. void    __CLIB randomize(void);
  86. void *    __CLIB calloc(size_t,size_t);
  87. void    __CLIB free(void *);
  88. void *    __CLIB malloc(size_t);
  89. void *    __CLIB realloc(void *,size_t);
  90. void    __CLIB abort(void);
  91. int    __CLIB atexit(void (*)(void));
  92. void    __CLIB exit(int);
  93. char *    __CLIB getenv(const char *);
  94. int    __CLIB system(const char *);
  95. void *    __CLIB bsearch(const void *,const void *,size_t,size_t,
  96.     int (__CLIB *)(const void *,const void *));
  97. void    __CLIB qsort(void *,size_t,size_t,
  98.     int (__CLIB *)(const void *,const void *));
  99. int    __CLIB abs(int);
  100. div_t    __CLIB div(int,int);
  101. long    __CLIB labs(long);
  102. ldiv_t    __CLIB ldiv(long,long);
  103. int    __CLIB mblen(const char *,size_t);
  104. int    __CLIB mbtowc(wchar_t *,const char *,size_t);
  105. int    __CLIB wctomb(char *,wchar_t);
  106. size_t    __CLIB mbstowcs(wchar_t *, const char *, size_t);
  107. size_t    __CLIB wcstombs(char *, const wchar_t *, size_t);
  108.  
  109. unsigned    __CLIB _rotl(unsigned,unsigned);
  110. unsigned    __CLIB _rotr(unsigned,unsigned);
  111. unsigned long    __CLIB _lrotl(unsigned long,unsigned);
  112. unsigned long    __CLIB _lrotr(unsigned long,unsigned);
  113. char * __CLIB _fullpath(char *buf,const char *path,int buflen);
  114. #define fullpath    _fullpath
  115. #ifndef __STDC__
  116. /* Non-ANSI functions    */
  117.  
  118. #ifndef __NT__
  119. extern unsigned short __cdecl _psp;
  120. #endif
  121.  
  122. extern unsigned char __cdecl _osmajor;
  123. extern unsigned char __cdecl _osminor;
  124. extern unsigned char __cdecl _osmode;
  125. extern unsigned char __cdecl _cpumode;
  126. extern volatile int __cdecl _doserrno;    /* MS-DOS error codes. Refer to the    */
  127.                 /* ERROR RETURN TABLE in your MS-DOS    */
  128.                 /* manual.                */
  129.  
  130. void __cdecl _splitpath(const char *, char *,char *, char *, char *);
  131. void __cdecl _makepath(char *, const char *,const char *, const char *, const char *);
  132. void __cdecl _searchenv(const char *filename, const char *varname, char *pathname);
  133.  
  134. size_t __cdecl _msize(void *);
  135. #if __LARGE__ || __COMPACT__ || __VCM__
  136. void * __cdecl _fmalloc(size_t);
  137. void * __cdecl _fcalloc(size_t,size_t);
  138. void * __cdecl _frealloc(void *,size_t);
  139. void __cdecl _ffree(void *);
  140. size_t __cdecl _fmsize(void *);
  141. unsigned long __cdecl coreleft(void);
  142. unsigned long __cdecl farcoreleft(void);
  143. #if _WINDOWS
  144. void __near * __cdecl _nmalloc(size_t);
  145. void __near * __cdecl _ncalloc(size_t,size_t);
  146. void __near * __cdecl _nrealloc(void __near *,size_t);
  147. void __cdecl _nfree(void __near *);
  148. size_t __cdecl _nmsize(void __near *);
  149. size_t __cdecl _memmax(void);
  150. size_t __cdecl _memavl(void);
  151. unsigned int __cdecl _freect(size_t);
  152. #endif
  153. #else
  154. void * __cdecl _nmalloc(size_t);
  155. void * __cdecl _ncalloc(size_t,size_t);
  156. void * __cdecl _nrealloc(void *,size_t);
  157. void __cdecl _nfree(void *);
  158. size_t __cdecl _nmsize(void *);
  159. size_t __cdecl _memmax(void);
  160. size_t __cdecl _memavl(void);
  161. unsigned int __cdecl _freect(size_t);
  162. unsigned __cdecl coreleft(void);
  163. unsigned long __cdecl farcoreleft(void);
  164. #if __INTSIZE == 2 || (!__NT__ && !__OS2__)
  165. void __far * __cdecl _fmalloc(size_t);
  166. void __far * __cdecl _fcalloc(size_t,size_t);
  167. void __far * __cdecl _frealloc(void __far *,size_t);
  168. void __cdecl _ffree(void __far *);
  169. size_t __cdecl _fmsize(void __far *);
  170. #endif
  171. #endif
  172.  
  173. #if __INTSIZE == 2
  174. void __huge *_halloc (long, size_t);
  175. void _hfree (void __huge *);
  176. #endif
  177.  
  178. char *    __CLIB itoa(int,char *,int);
  179. char *    __CLIB ltoa(long, char *, int);
  180. char *  __CLIB ultoa(unsigned long, char *, int);
  181. char *    __CLIB ecvt(double,int,int *,int *);
  182. char *    __CLIB fcvt(double,int,int *,int *);
  183. char *    __CLIB gcvt(double,int,char *);
  184. void *    __CDECL sbrk(size_t);
  185. void    __CLIB swab(char *,char *,size_t);
  186. float    __CLIB strtof(const char *,char **);
  187. #define _swab swab
  188. #define _ecvt ecvt
  189. #define _fcvt fcvt
  190. #define _gcvt gcvt
  191. #define strtold    strtod
  192. #define _strtold    strtod
  193. #define _itoa itoa
  194. #define _ltoa ltoa
  195. #define _ultoa ultoa
  196. void __ss *    __CLIB alloca(size_t);
  197. #define _alloca alloca
  198. size_t __CLIB stackavail(void);
  199. size_t __CLIB _chkstack(void);
  200. #define _stackavail stackavail
  201.  
  202. #if __NT__ || (__OS2__ && __INTSIZE == 4)
  203. int __cdecl _fatexit (void (__cdecl *func)(void));
  204. typedef void (__cdecl * _fonexit_t)(void);
  205. _fonexit_t __cdecl _fonexit (_fonexit_t func);
  206. #else
  207. int __cdecl _fatexit (void (__cdecl __far *func)(void));
  208. typedef void (__cdecl __far * _fonexit_t)(void);
  209. _fonexit_t __cdecl _fonexit (_fonexit_t func);
  210. #endif
  211.  
  212. typedef void (__cdecl * _onexit_t)(void);
  213. _onexit_t __cdecl _onexit (_onexit_t func);
  214.  
  215. #if __INTSIZE == 2
  216. void __far * __far __CLIB __mallocf(size_t);
  217. void         __far __CLIB __freef(void __far *);
  218. #endif
  219. int        __CLIB putenv(const char *);
  220.  
  221. #define _putenv putenv
  222.  
  223. #ifndef __cplusplus
  224. #ifndef max
  225. #define max(a,b)            (((a) > (b)) ? (a) : (b))
  226. #define __max(a,b)            (((a) > (b)) ? (a) : (b))
  227. #endif
  228.  
  229. #ifndef min
  230. #define min(a,b)            (((a) < (b)) ? (a) : (b))
  231. #define __min(a,b)            (((a) < (b)) ? (a) : (b))
  232. #endif
  233. #endif
  234.  
  235. extern int (__far __CDECL *_malloc_handler)(void);
  236. extern char * __CDECL _envptr;
  237.  
  238. #if M_UNIX || M_XENIX
  239. extern char ** __CDECL _environ[];
  240. #endif
  241.  
  242. #endif
  243.  
  244. #if __cplusplus
  245. }
  246. #endif
  247.  
  248. #endif /* __STDLIB_H */
  249.